
BlogAddCtrl.$inject = ['$scope', '$http', 'BlogGetThreadNew'];


function BlogAddCtrl($scope, $http, BlogGetThreadNew) {

	// JQUERY UPLOAD STUFF
	console.log ("BlogReadItem")


    $scope.isAttachFilePanellHidden = true;

        

    // CODE MIRROR STUFF
	$scope.editorOptions = {
        lineWrapping : true,
        lineNumbers: true,
        readOnly: 'nocursor',
        mode: 'xml',
    };

    $scope.clearCode = function(){
		$scope.threadInfo.thread.code = ''
	}
	

    $scope.reParseInput = function(){
	  /*  $scope.errorMsg = "";
	    $timeout.cancel(pending);
	    pending = $timeout($scope.workHere, 500);*/
	};



	$scope.init = function (){

	    // Get thread info
		BlogGetThreadNew.get( {  },  function(data) {
		     if (data.result.status == "ok")
		     {
		      $scope.threadInfo = data;
		      console.log ("LLL", BlogGetThreadNew)
		      
		      $scope.tags = data.tags;
		      $scope.selectedTag =  $scope.tags[0]

		      $scope.usersToNotify = data.users;

		      $scope.tinymce =  data.thread.msg;
		      
		    //  $scope.todos[catIndex].opened.splice(todoIndex, 1)
		     }
	    });

	}
	
	$scope.save  = function(){
		console.log ("save")
	}


}




